package com.kf.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.ApiSelectorBuilder;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

/**
 * @author Honey
 */
@EnableSwagger2
@Configuration
public class SwaggerConfig {
    @Bean
    public Docket createRestApi() {
        Docket docket = new Docket(DocumentationType.SWAGGER_2);
        //作者信息
        Contact contact = new Contact("彭于晏", "localhost:8080", "1234@qq.com");
        ApiInfo apiInfo = new ApiInfo("毕业论文管理系123统", "", "v1.0", "localhost:8080", contact, "Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0", new ArrayList<>());
        docket.apiInfo(apiInfo);
        docket.groupName("峰峰");
        ApiSelectorBuilder select = docket.select();
        //指定需要扫描的包
        select.apis(RequestHandlerSelectors.basePackage("com.kf.controller"));
        select.build();
        //路径，过滤什么路径
//        select.paths()
        return docket;
    }
}
